<?
// MyMyUNSW: session handling functions

// isLoggedIn:
// - check that this is a session by a logged-in user
 
function userID()
{
	if (!isset($_SESSION["myUser"]))
		return -1;
	else
		return $_SESSION["myUser"];
}
 
function userName()
{
	if (!isset($_SESSION["myName"]))
		return "???";
	else
		return $_SESSION["myName"];
}
 
function userType()
{
	if (!isset($_SESSION["myType"]))
		return "???";
	else
		return $_SESSION["myType"];
}

/****
function isLoggedIn() { return true; }
function isStudent() { return false; }
function isStaff() { return true; }
function isAdmin() { return false; }
*****/
function isLoggedIn() { return isset($_SESSION['myUser']); }
function isStudent() { return (userType() == "student"); }
function isStaff() { return (userType() == "staff"); }
function isAdmin() { return (userType() == "admin"); }
